package com.gopay.common.rcs.dao.dispute.impl;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.domain.rcs.RcsDisputeOrderReason;
import com.gopay.common.rcs.dao.dispute.RcsDisputeOrderReasonDAO;

/**
 * 纠纷原因
 * @RcsDisputeOrderReasonDAOImpl.java
 * @author mz
 * @Mar 6, 2014 5:09:46 PM  www.gopay.com.cn Inc.All rights reserved.
 */
@Repository("rcsDisputeOrderReasonDAO")
public class RcsDisputeOrderReasonDAOImpl  extends BaseDAOImpl<RcsDisputeOrderReason, Serializable>implements RcsDisputeOrderReasonDAO {

	@Override
	public RcsDisputeOrderReason findRcsDisputeOrderReasonById(String id) {
		Map<String,Object> params = new HashMap<String,Object>();
        params.put("sq", id);
		List<RcsDisputeOrderReason> l = super.findByHql("from RcsDisputeOrderReason where sq=:sq and del=0", params);
        return l.size() > 0 ? l.get(0) : null;
	}

	@Override
	public List<RcsDisputeOrderReason> findRcsDisputeOrderReasons() {
		return super.findByHql("from RcsDisputeOrderReason where del=0 ");
	}
	
	
	
	@Override
	public List<RcsDisputeOrderReason> findRcsDisputeOrderReasonsWithDel() {
		return super.findByHql("from RcsDisputeOrderReason  ");
	}

	@Override
	public RcsDisputeOrderReason findRcsDisputeOrderReasonByReason(String reason) {
		Map<String,Object> params = new HashMap<String,Object>();
        params.put("reason", reason);
		List<RcsDisputeOrderReason> l = super.findByHql("from RcsDisputeOrderReason where reason=:reason ", params);
        return l.size() > 0 ? l.get(0) : null;
	}


	
	
}
